package org.mzx.shortLink.work.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.RequiredArgsConstructor;
import org.mzx.shortLink.starter.convention.Result.Result;
import org.mzx.shortLink.starter.web.Results;
import org.mzx.shortLink.work.dto.Request.ShortLinkRecycleBinPageReqDTO;
import org.mzx.shortLink.work.dto.Request.recycleBinAddDtoReq;
import org.mzx.shortLink.work.dto.Response.TLinkPageDtoResp;
import org.mzx.shortLink.work.service.recycleBinService;
import org.springframework.web.bind.annotation.*;

@RestController
@RequiredArgsConstructor
public class recycleBinController {

    private final recycleBinService service;
    @PostMapping("/api/short-link/v1/recycle-bin/save")
    public Result<Void> addToBin(@RequestBody recycleBinAddDtoReq requestParam) {
        return Results.success(service.addToBin(requestParam));
    }

    @GetMapping("/api/short-link/v1/recycle-bin/page")
    public Result<IPage<TLinkPageDtoResp>> getByPage(ShortLinkRecycleBinPageReqDTO requestParam) {
        return Results.success(service.getByPage(requestParam));
    }

    @PostMapping("/api/short-link/v1/recycle-bin/recover")
    public Result<Void> recoverRecycleBin(recycleBinAddDtoReq requestParam) {
        return Results.success(service.recoverRecycleBin(requestParam));
    }

    @PostMapping("/api/short-link/v1/recycle-bin/remove")
    public Result<Void> removeRecycleBin(@RequestBody recycleBinAddDtoReq requestParam) {
        return Results.success(service.removeRecycleBin(requestParam));
    }
}
